<div class="bjui-pageHeader">
    <form id="pagerForm" data-toggle="ajaxsearch" action="${request.getContextPath()}/UserWork/userWork?params=1"
          method="post">
        <div class="bjui-searchBar">
            <g:hiddenField name="SYS_QUERY_NAME" value="userWork"/>
            <g:hiddenField name="EXPORT_CONTENT_NAME" value="Excel"/>
            <label>作业员工号：</label>
            <input type="text" name="user" value="${user}" size="17" placeholder="作业员工号"/>&nbsp;
            <label>作业员姓名：</label>
            <input type="text" name="userName" value="${userName}" size="17" placeholder="作业员姓名"/>&nbsp;
            <label>部门：</label>
            <input type="text" name="department" value="${department}" size="17" placeholder="部门"/>&nbsp;
            <label>批次：</label>
            <input type="text" name="lotId" value="${lotId}" size="17" placeholder="批次"/>&nbsp;
            <label>工序：</label>
            <g:select name="step" from="${userWorkStepList}" data-toggle="selectpicker" data-live-search="true"
                      optionKey="step" optionValue="step" data-width="130" value="${step}"
                      noSelection="['': '-- All --']"/>
            <br/><br/>
            <label>存货编码：</label>
            <input type="text" name="partName" value="${partName}" size="17" placeholder="存货编码"/>&nbsp;
            <label>内部图号：</label>
            <input type="text" name="group3" value="${group3}" size="17" placeholder="内部图号"/>&nbsp;
            <label>加工设备：</label>
            <input type="text" name="eqp" value="${eqp}" size="17" placeholder="加工设备"/>&nbsp;
        %{--<label>批次：</label>
        <g:select name="lotId" from="${userWorkLotList}" data-toggle="selectpicker" data-live-search="true" optionKey="lot_id" optionValue="lot_id" value="${lotId}" noSelection="['': '===ALL===']"/>&nbsp;
        <label>作业员：</label>
        <g:select name="user" from="${userWorkUserList}" data-toggle="selectpicker" data-live-search="true" optionKey="work_user" optionValue="work_user" value="${user}" noSelection="['': '===ALL===']"/>&nbsp;
        <label>工序：</label>
        <g:select name="step" from="${userWorkStepList}" data-toggle="selectpicker" data-live-search="true" optionKey="step" optionValue="step" value="${step}" noSelection="['': '===ALL===']"/>&nbsp;
        <label>物料编码：</label>
        <g:select name="partName" from="${userWorkPartNameList}" data-toggle="selectpicker" data-live-search="true" optionKey="part_name" optionValue="part_name" value="${partName}" noSelection="['': '===ALL===']"/>&nbsp;

        <label>产品图号：</label>
        <g:select name="group3" from="${userWorkGroupList}" data-toggle="selectpicker" data-live-search="true" optionKey="group3" optionValue="group3" value="${group3}" noSelection="['': '===ALL===']"/>&nbsp;
        <label>加工设备：</label>
        <g:select name="eqp" from="${userWorkEqpList}" data-toggle="selectpicker" data-live-search="true" optionKey="jiagong_eqp" optionValue="jiagong_eqp" value="${eqp}" noSelection="['': '===ALL===']"/>&nbsp;--}%
            <label>时间<strong><span class="text-danger">*</span></strong>：</label>
            <input type="text" name="startTime" readonly value="${startTime}" size="12" data-rule="required"
                   data-toggle="datepicker" placeholder="FROM">
            <input type="text" name="endTime" readonly value="${endTime}" size="12" data-rule="required"
                   data-toggle="datepicker" placeholder="TO">&nbsp;
            <br/><br/>
            <button type="submit" class="btn-default" data-icon="search">查询</button>
            %{--<button type="button" class="btn-blue" onclick="javascript:bjuiExportExl('#pagerForm','${request.getContextPath()}/StageWip/exportExcel')" --}%
            %{--data-icon="file-excel-o" title="导出Excel">导出</button>--}%
            <a type="button" class="btn btn-blue" href="${request.getContextPath()}/Base/exportExcel"
               data-toggle="doexport" data-confirm-msg="确定要导出吗？" data-icon="file-excel-o" title="导出Excel">导出</a>
        </div>
    </form>
</div>

<div class="bjui-pageContent tableContent">
    <g:if test="${userWork.size() > 0}">
        <table data-toggle="tablefixed" data-width="100%" data-nowrap="true">
            <thead>
            <tr>
                <g:each in="${tableHeadList}" status="j" var="headInstance">
                    <g:if test="${headInstance != 'RN'}">
                        <th width="125"><g:message code="${headInstance}" default="${headInstance}"/></th>
                    </g:if>
                </g:each>
            </tr>
            </thead>
            <tbody>
            <g:each in="${userWork}" status="i" var="dataInstance">
                <tr>
                    <g:each in="${tableHeadList}" status="j" var="headInstance">
                        <g:if test="${headInstance == 'MAIN_QTY'}">
                            <td name="USERWORKQTY${i}">${dataInstance["${headInstance}"]}</td>
                        </g:if>
                        <g:elseif test="${headInstance != 'RN'}">
                            <td>${dataInstance["${headInstance}"]}</td>
                        </g:elseif>
                    </g:each>
                </tr>
            </g:each>
            <tr>
                <td colspan="12">小计</td>
                <td name="userWorkShow"></td>
            </tr>
            <tr>
                <td colspan="12">合计</td>
                <td>${userWorkSumQty.SUM_QTY[0]}</td>
            </tr>
            </tbody>
        </table>
    </g:if>
    <g:else>
        <g:render template="../template/emptyPanel"/>
    </g:else>
</div>

<g:render template="../template/51pagination"/>
<script>
    $(function () {
        var userWorkQty = 0;
        for (var i = 0; i <${userWork.size()}; i++) {
            var userworkqty = 'USERWORKQTY' + i
            var userWorkAdd = $("td[name='" + userworkqty + "']").text() == '' ? 0 : parseInt($("td[name='" + userworkqty + "']").text())
            userWorkQty += userWorkAdd
        }
        $("td[name='userWorkShow']").html(userWorkQty)
    })
</script>